#!/bin/bash

env=$1

# 安装kubekey
export KKZONE=cn
export VERSION=v2.2.2
chmod +x /kubesphere/download-kubekey.sh
dos2unix /kubesphere/download-kubekey.sh
/kubesphere/download-kubekey.sh
chmod +x kk

# 通过kubekey安装k8s集群和kubesphere
echo "yes" | ./kk create cluster -f /kubesphere/config-$env.yaml

# 避免使用heml时报warnning ==> WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
chmod -R 600 /root/.kube/config

# 安装openelb教程：ttps://itcn.blog/p/1826140548.html

# 安装内网穿透frp